﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using Baza.EF.DAL;
using Baza.EF.BLL;


namespace Pep_3014_3070_Desktop
{
    public partial class RemoveCustomer : Form
    {
        public RemoveCustomer()
        {
            InitializeComponent();
        }

        private void RemoveCustomer_Load(object sender, EventArgs e)
        {
            cmbKlijent.DataSource = DAKorisnici.SelectAllCustomers();
            cmbKlijent.DisplayMember = "FirstName";
        }

        private void cmbKlijent_Format(object sender, ListControlConvertEventArgs e)
        {
            string lastname = ((Customers)e.ListItem).FirstName;
            string firstname = ((Customers)e.ListItem).LastName;
            e.Value = lastname + " " + firstname;
        }

        private void btnSpremi_Click(object sender, EventArgs e)
        {
            Customers customer = (Customers)cmbKlijent.SelectedItem;

            DAKorisnici.RemoveBYCustomerID(customer.CustomerID);
        }

        private void btnOdustani_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
